Skip to content

Conversation

@isoos
Copy link
Collaborator

@isoos isoos commented May 29, 2025

  • Provides a consistent 1-2% latency improvement.
  • Note: I've also investigated how to reduce the use of IndexedScore, but seems to be a bit more involved, postponing it for now (with a follow-up PR that may prepare it).

@isoos isoos requested review from jonasfj and sigurdm May 29, 2025 13:45
Comment on lines +188 to +192
class BitArrayPool<K> {
final int _length;
final _pool = <BitArray>[];

BitArrayPool(this._length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter too much, but I guess it could be generic, sharing implentation with ScorePool (if you pass a constructor).

Suggested change
class BitArrayPool<K> {
final int _length;
final _pool = <BitArray>[];
BitArrayPool(this._length);
class AllocationPool<T> {
final _pool = <T>[];
final T Function() constructor;
AllocationPool(this.constructor);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked but with the ScorePool's variable initialization parameter, it requires a bit of refactoring first. I'll do that in a follow-up PR.

@isoos isoos merged commit da83304 into dart-lang:master Jun 2, 2025
31 checks passed
@isoos isoos deleted the bitarray-pool branch June 2, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants